package com.snow.fvmusic.generator.mapper;

import com.snow.fvmusic.generator.entities.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author snow
 * @since 2020-09-19
 */
public interface UserMapper extends BaseMapper<User> {

    @Update("update user set concern_count  = concern_count + #{num} where id = #{userId}")
    void incrOrDecrConcernCount(Long userId, int num);

    @Update("update user set fans_count = fans_count + #{num} where id = #{userId}")
    void incrOrDecrFansCount(Long userId, int num);

    List<User> allUsers();

}
